import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', () => {
  //用户对象数据
  const user = ref({})

  //getter的计算属性：获取用户对象
  const getUser = computed(() => user)

  //action的方法：设置用户对象的值
  function setUser(u) {
    user.value=u
  }

  return { user, getUser, setUser }
})
